home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / PCI Driver Development Kit / • Tools / Utility / PCISlots / PCISlots.make < prev    next >
Encoding:
Text File  |  1996-08-20  |  12.9 KB  |  385 lines  |  [TEXT/MPS ]

  1. # Copyright © 1995 by Apple Computer, Inc.  All rights reserved.
  2. # PCISlots.make
  3. #
  4. #FILE
  5. #    PCISlots.make
  6. #
  7. #NAME
  8. #    PCI Slot Peek application makefile
  9. #
  10. #DESCRIPTION
  11. #    This make file contains Make instructions that builds the
  12. #    PCI Slot Peek application
  13. #
  14. #MODIFICATION HISTORY
  15. #    Created by Terry Teague
  16. #
  17. #    20 Apr 95    -    TRT    -    Initial version
  18. #    17 Jul 95    -    TRT    -    Tidy-up source for PPCC v1.0.5, Universal Headers v2.0 final,
  19. #                                    CodeWarrior 6.1.
  20. #
  21. #=============================================================================================
  22. #
  23.  
  24. #=============================================================================================
  25. # Common Variables
  26. #=============================================================================================
  27.  
  28. Includes            =    :Includes:
  29. Sources            =    :Sources:
  30. Resources        =    :Resources:
  31. 68K_Objects        =    :68K_Objects:
  32. PPC_Objects        =    :PPC_Objects:
  33.  
  34. MacsBug            =    off
  35. Symbols            =    off
  36.  
  37. PPCCOpt            =    off
  38.  
  39. PreUniHeaders    =    -d qPreUniHeaders=0    #set to 0 for Universal Headers
  40. OtherCOptions    =
  41.  
  42. #=============================================================================================
  43. # Variables needed to set up for this application
  44. #=============================================================================================
  45.  
  46. BaseName            =    PCISlots
  47. 68K_sprintfLib    =
  48. PPC_sprintfLib    =
  49. 68K_ProgName    =    {BaseName}.68K
  50. PPC_ProgName    =    {BaseName}.PPC
  51. FAT_ProgName    =    {BaseName}.FAT
  52. RezName            =    {BaseName}.r
  53. RsrcName            =    {BaseName}.rsrc
  54. MakeName            =    {BaseName}.make
  55.  
  56. # Pseudo targets - Build script controls if 68K and/or PPC builds are done
  57.  
  58. Build68K            =    {68K_ProgName}
  59. BuildPPC            =    {PPC_ProgName}
  60.  
  61. #=============================================================================================
  62. # Object files used by this example
  63. #=============================================================================================
  64.  
  65. # We don't need the NameRegistry code for 68K since it is not supported in that mode
  66. 68K_LinkObjs    =    ∂
  67.                         "{68K_Objects}"{BaseName}.cp.68K.o ∂
  68.                         "{68K_Objects}"{BaseName}Utils.cp.68K.o
  69. #                        "{68K_Objects}"{BaseName}NameRegistry.cp.68K.o
  70.  
  71. PPC_LinkObjs    =    ∂
  72.                         "{PPC_Objects}"{BaseName}.cp.PPC.o ∂
  73.                         "{PPC_Objects}"{BaseName}Utils.cp.PPC.o ∂
  74.                         "{PPC_Objects}"{BaseName}NameRegistry.cp.PPC.o
  75.                         
  76. #=============================================================================================
  77. # Standard Libraries used by this application
  78. #=============================================================================================
  79.  
  80. 68K_SIOW_Lib    =    ∂
  81.                         "{Libraries}"SIOW.o
  82.  
  83. 68K_Libraries    =    ∂
  84. #                        "{Libraries}Stubs.o" ∂
  85.                         "{CLibraries}"CPlusLib.o ∂
  86.                         "{CLibraries}"StdCLib.o ∂
  87.                          "{Libraries}"Runtime.o ∂
  88.                          "{Libraries}"Interface.o 
  89.  
  90. PPC_SIOW_Lib    =    ∂
  91.                         "{PPCLibraries}"PPCSIOW.o
  92.  
  93. PPC_Libraries    =    ∂
  94.                         "{PCILibraries}"NameRegistryLib ∂
  95.                         "{PPCLibraries}"InterfaceLib.xcoff ∂
  96.                         "{PPCLibraries}"StdCLib.xcoff ∂
  97.                         "{PPCLibraries}"StdCRuntime.o ∂
  98.                         "{PPCLibraries}"PPCCRuntime.o ∂
  99.                         "{PPCLibraries}"MathLib.xcoff ∂
  100.                         "{PPCLibraries}"CPlusLib.o
  101.  
  102. # The -w options for MakePef makes those libraries "weak" imports, meaning
  103. # they can be absent at runtime.  The app must check before calling them.
  104. # All symbols in NameRegistryLib are weak-linked (~)
  105. # This doesn't work for me for some reason
  106. #
  107.  
  108. PPC_LibEquates    =    ∂
  109.                         -l NameRegistryLib.xcoff=NameRegistryLib~ ∂
  110.                         -w NameRegistryLib:RegistryEntryIterateCreate ∂
  111.                         -w NameRegistryLib:RegistryEntryIterateDispose ∂
  112.                         -w NameRegistryLib:RegistryEntryIterate ∂
  113.                         -w NameRegistryLib:RegistryEntryIDDispose ∂
  114.                         -w NameRegistryLib:RegistryPropertyGetSize ∂
  115.                         -w NameRegistryLib:RegistryPropertyGet ∂
  116.                         -w NameRegistryLib:RegistryEntryToPathSize ∂
  117.                         -w NameRegistryLib:RegistryCStrEntryToPath ∂
  118.                         -l InterfaceLib.xcoff=InterfaceLib ∂
  119.                     -l StdCLib.xcoff=StdCLib ∂
  120.                         -l MathLib.xcoff=MathLib
  121.  
  122. #=============================================================================================
  123. # Include Paths
  124. #=============================================================================================
  125.  
  126. RezIncludePath        =    -i "{Includes}" -i "{RIncludes}" ∂
  127.                             -s : -s {Resources}
  128.  
  129. CIncludes            =    "{PPCCIncludes}"    # prevent C68K from using non-Universal Headers
  130.  
  131. CIncludePath        =    -i "{Includes}" -i "{PPCCIncludes}" -i "{PCICIncludes}" #"{CIncludes}"
  132.  
  133. PIncludePath        =
  134.  
  135. AIncludePath        =    -i "{Includes}" -i "{AIncludes}"
  136.  
  137. CPlusIncludePath    =    -i "{Includes}" -i "{PPCCIncludes}" -i "{PCICIncludes}" #"{CIncludes}"
  138.  
  139. PPCCIncludePath    =    -i "{Includes}" -i "{PPCCIncludes}" -i "{PCICIncludes}" #"{CIncludes}"
  140.  
  141. #=============================================================================================
  142. # Other definitions
  143. #=============================================================================================
  144.  
  145. OtherDependencies =    ∂
  146.                             {BaseName}NameRegistry.PEF
  147.  
  148. #=============================================================================================
  149. # Tool Options
  150. #=============================================================================================
  151.  
  152. COptions            =            -mbg {MacsBug} -sym {Symbols} {PreUniHeaders} {CIncludePath} {OtherCOptions} ∂
  153.                                 -mf -b2 -r
  154.  
  155. POptions            =            -mbg {MacsBug} -sym {Symbols} {PIncludePath}
  156.  
  157. AOptions            =            -sym {Symbols} {AIncludePath}
  158.  
  159. CPlusOptions    =            -mbg {MacsBug} -sym {Symbols} {PreUniHeaders} {CPlusIncludePath} {OtherCOptions} ∂
  160.                                 -mf -b2 -r #-warnings off -mark all #-load {Objects}headers.h.dump
  161.  
  162. PPCCOptions        =            -sym {Symbols} {PreUniHeaders} {PPCCIncludePath} {OtherCOptions} ∂
  163.                                 -w conformance -appleext on -opt {PPCCOPt}
  164.  
  165. RezOptions        =            -c 'PCI?' -t APPL
  166.  
  167. LinkOpts            =            -mf -c 'PCI?' -t APPL ∂
  168.                                 -sym {Symbols}
  169.  
  170. PPCLinkOpts        =            -warn -xm executable -main __cplusstart ∂
  171.                                 -sym {Symbols}
  172.  
  173. PEF_Options        =            -ft APPL -fc 'PCI?'
  174.  
  175. #=============================================================================================
  176. # Default Rule Customization
  177. #=============================================================================================
  178.  
  179. "{68K_Objects}"        ƒ    "{Sources}"
  180.  
  181. "{PPC_Objects}"        ƒ    "{Sources}"
  182.  
  183. .cp.68K.o ƒ .cp #{Objects}headers.h.dump
  184.     CPlus "{Sources}{default}.cp" -o "{68K_Objects}{default}.cp.68K.o" {CPlusOptions}
  185.     
  186. .cp.PPC.o ƒ .cp #{Objects}headers.h.dump
  187.     PPCC "{Sources}{default}.cp" -o "{PPC_Objects}{default}.cp.PPC.o" {PPCCOptions}
  188.     
  189. .a.o ƒ .a
  190.     Asm "{Sources}{default}.a" -o "{68K_Objects}{default}.a.o" {AOptions}
  191.  
  192. .c.68K.o ƒ .c
  193.     C "{Sources}{default}.c" -o "{68K_Objects}{default}.c.68K.o" {COptions}
  194.     
  195. .c.PPC.o ƒ .c
  196.     PPCC "{Sources}{default}.c" -o "{PPC_Objects}{default}.c.PPC.o" {PPCCOptions}    
  197.  
  198. "{68K_Objects}"{BaseName}.cp.68K.o        ƒ    "{Sources}"{BaseName}.cp ∂
  199.                                                     "{Includes}"{BaseName}.h
  200.  
  201. "{PPC_Objects}"{BaseName}.cp.PPC.o        ƒ    "{Sources}"{BaseName}.cp ∂
  202.                                                     "{Includes}"{BaseName}.h
  203.  
  204. "{68K_Objects}"{BaseName}NameRegistry.cp.68K.o        ƒ    "{Sources}"{BaseName}NameRegistry.cp ∂
  205.                                                     "{Includes}"{BaseName}.h
  206.  
  207. "{PPC_Objects}"{BaseName}NameRegistry.cp.PPC.o        ƒ    "{Sources}"{BaseName}NameRegistry.cp ∂
  208.                                                     "{Includes}"{BaseName}.h
  209.  
  210. "{PPC_Objects}"{BaseName}Utils.cp.PPC.o        ƒ    "{Sources}"{BaseName}Utils.cp ∂
  211.                                                     "{Includes}"{BaseName}.h
  212.  
  213. #=============================================================================================
  214. # Makefile Dependency
  215. # Add '#' in front of the build rule if you do not want that group of object files to
  216. # depend on the makefile.
  217. #=============================================================================================
  218.  
  219. #{68K_LinkObjs}            ƒ    "{MakefileName}"
  220.  
  221. #{PPC_LinkObjs}            ƒ    "{MakefileName}"
  222.  
  223. #=============================================================================================
  224. # Include-file Dependences
  225. #    List only the files that include other files
  226. #=============================================================================================
  227.  
  228. #=============================================================================================
  229. # Special compiler options
  230. #    For sources files that need special compiler options like -s segName or -d
  231. #=============================================================================================
  232.  
  233. #=============================================================================================
  234. # Build Commands
  235. #=============================================================================================
  236.  
  237. "{BaseName}"    ƒ    "{Build68K}" "{BuildPPC}"    # build 68K and/or PPC versions (pseudo targets)
  238.     If ("{Build68K}" != "") And ("{BuildPPC}" != "")
  239.     
  240.         # Duplicate the PowerPC code into the fat binary package.
  241.         
  242.         duplicate -y {PPC_ProgName} {FAT_ProgName}
  243.         
  244.         # rez in 'CODE' resources from 68K version. (Brute force method).
  245.         
  246.         echo "include ∂"{68K_ProgName}∂" 'CODE';" | rez -a -o {FAT_ProgName}
  247.         
  248.         # delete 'cfrg' resources from 68K version. (Brute force method).
  249.         # Get the PEF container and store it into a resource in the 68K version. (Brute force method). 
  250.         
  251.         echo "read 'XCOF' (10000, ∂"native PPC NameRegistry code∂") ∂"PCISlotsNameRegistry.PEF∂"; delete 'cfrg';" ∂
  252.         | rez -a -o {68K_ProgName}
  253.     
  254.     Else If ("{Build68K}" != "")
  255.     
  256.         # delete 'cfrg' resources from 68K version. (Brute force method).
  257.         # Get the PEF container and store it into a resource in the 68K version. (Brute force method). 
  258.         
  259.         echo "read 'XCOF' (10000, ∂"native PPC NameRegistry code∂") ∂"PCISlotsNameRegistry.PEF∂"; delete 'cfrg';" ∂
  260.         | rez -a -o {68K_ProgName}
  261.     
  262.     End
  263.  
  264. #=============================================================================================
  265. # Build the resource file(s)
  266. #=============================================================================================
  267.  
  268. "{68K_ProgName}"    ƒƒ    "{Resources}{RezName}" ∂
  269.                         "{Resources}{RsrcName}" ∂
  270.                         {BaseName}NameRegistry.PEF ∂
  271.                         {OtherDependencies}
  272.     If "{BuildPPC}" != ""
  273. # need to make sure we Rez in the PowerPC native stuff if we are building a FAT application
  274. # because currently the Make file will only build the 68K version of the resource file
  275.     Rez {RezIncludePath} ∂
  276.             {RezOptions} ∂
  277.             -d APPNAME=∂"{PPC_ProgName}∂" ∂
  278.             "{Resources}{RezName}" ∂
  279.             -append ∂
  280.             -o "{68K_ProgName}"
  281.     Else
  282.             Rez {RezIncludePath} ∂
  283.             {RezOptions} ∂
  284.             "{Resources}{RezName}" ∂
  285.             -append ∂
  286.             -o "{68K_ProgName}"
  287.     End
  288.     
  289. "{PPC_ProgName}"    ƒƒ    "{Resources}{RezName}" ∂
  290.                         "{Resources}{RsrcName}" ∂
  291.                         {OtherDependencies}
  292.     Rez {RezIncludePath} ∂
  293.         {RezOptions} ∂
  294.         -d APPNAME=∂"{PPC_ProgName}∂" ∂
  295.         "{Resources}{RezName}" ∂
  296.         -append ∂
  297.         -o "{PPC_ProgName}"
  298.     
  299. #=============================================================================================
  300. # Link the 68K code
  301. #=============================================================================================
  302.  
  303. {68K_ProgName}        ƒƒ    {68K_LinkObjs} {68K_sprintfLib}
  304.     Link    ∂
  305.             {LinkOpts} ∂
  306.             {68K_LinkObjs} ∂
  307.             {68K_sprintfLib} ∂
  308.             {68K_SIOW_Lib} ∂
  309.             {68K_Libraries} ∂
  310.             -o {68K_ProgName}
  311. #            -map ∂
  312. #            > "{68K_ProgName}".map
  313.  
  314. #=============================================================================================
  315. # Link the native PPC code
  316. #=============================================================================================
  317.  
  318. {PPC_ProgName}    ƒƒ    {BaseName}.xcoff
  319.     MakePEF  {PEF_Options} ∂
  320.                 {BaseName}.xcoff ∂
  321.                 {PPC_LibEquates} ∂
  322.                 -o {PPC_ProgName}                    
  323.     
  324. {BaseName}.xcoff    ƒ    {PPC_LinkObjs} {PPC_sprintfLib}
  325.     PPCLink ∂
  326.         {PPC_LinkObjs} ∂
  327.         {PPC_sprintfLib} ∂
  328.         {PPC_SIOW_Lib} ∂
  329.         {PPC_Libraries} ∂
  330. #
  331. # This option is required for the new version of PPCLink (1.0.5), and is not
  332. # supported with older versions
  333. #
  334.         -outputFormat xcoff ∂
  335. #
  336.         {PPCLinkOpts} ∂
  337.         -o {BaseName}.xcoff
  338.     If "{Symbols}" =~ /[oO][nN]/
  339.          #
  340.        # Suppress warnings because of boring "Can't find file:" messages for lib routines.
  341.        #
  342.        MakeSYM -w {BaseName}.xcoff
  343.     End
  344.     
  345. #=============================================================================================
  346. # Link the native PPC code that is used by a 68K version of the application
  347. #=============================================================================================
  348.  
  349. {BaseName}NameRegistry.PEF    ƒƒ    {BaseName}.NameRegistry.xcoff
  350.     MakePEF  ∂
  351. #                -i InitNativeNameRegistry ∂
  352.                 {PEF_Options} ∂
  353.                 {BaseName}.NameRegistry.xcoff ∂
  354.                 {PPC_LibEquates} ∂
  355.                 -o {BaseName}NameRegistry.PEF
  356.     
  357. {BaseName}.NameRegistry.xcoff    ƒ    "{PPC_Objects}"{BaseName}NameRegistry.cp.PPC.o {PPC_sprintfLib}
  358.     PPCLink ∂
  359.         "{PPC_Objects}"{BaseName}NameRegistry.cp.PPC.o ∂
  360.         {PPC_sprintfLib} ∂
  361.         {PPC_Libraries} ∂
  362. #
  363. # This option is required for the new version of PPCLink (1.0.5), and is not
  364. # supported with older versions
  365. #
  366.         -outputFormat xcoff ∂
  367. #
  368.         -warn -xm sharedLibrary -sym {Symbols} ∂
  369.         -export RegistryEntryIterateCreateRD ∂
  370.         -export RegistryEntryIterateDisposeRD ∂
  371.         -export RegistryEntryIterateRD ∂
  372.         -export RegistryEntryIDDisposeRD ∂
  373.         -export RegistryPropertyGetSizeRD ∂
  374.         -export RegistryPropertyGetRD ∂
  375.         -export RegistryEntryToPathSizeRD ∂
  376.         -export RegistryCStrEntryToPathRD ∂
  377.          -o {BaseName}.NameRegistry.xcoff
  378.     If "{Symbols}" =~ /[oO][nN]/
  379.          #
  380.        # Suppress warnings because of boring "Can't find file:" messages for lib routines.
  381.        #
  382.        MakeSYM -w {BaseName}.NameRegistry.xcoff
  383.     End
  384.     
  385.